<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>
<div class="container breadcrumbs">
    <a href="<?php echo $this->url('shop'); ?>"><?php echo $this->translate('首页'); ?></a>
    <span class="sep">/</span><span><?php echo $this->translate('商品评价'); ?></span>
</div>
<div class="container">
    <div class="uc-full-box">
        <div class="row">
            <div class="span4">
                <?php echo $this->partial('shop/partial/home/leftMenu'); ?>
            </div>
            <div class="span16">
                <div class="xm-line-box uc-box uc-order-detail-box">
                    <div class="box-hd">
                        <h3 class="title">
                            <?php echo $this->translate('商品评价'); ?>
                        </h3>
                        <div class="more">
                            <a href="<?php echo $this->url('home-order', [], ['query' => ['orderStatus' => $this->shopHelper()->getOrderStatusCode('goods_received') . '-' . $this->shopHelper()->getOrderStatusCode('complete')]]); ?>" class="btn btn-primary btn-small"><?php echo $this->translate('返回订单列表'); ?></a>
                        </div>
                    </div>
                    <div class="box-bd">
                        <div class="order-detail-tables">
                            <table class="order-detail-table">
                                <thead>
                                <tr>
                                    <th colspan="4" class="column-info">
                                        <div class="column-content"><?php echo $this->translate('评价信息'); ?>
                                        </div>
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td class="column-detail" width="50%">
                                        <ul class="order-goods-list">
                                            <li class="first">
                                                <a href="<?php echo $this->url('shop-goods', ['id' => $this->orderGoodsInfo->getGoodsId()]); ?>" target="_blank">
                                                    <img src="<?php echo $this->shopHelper()->baseGoodsImagePath($this->orderGoodsInfo->getGoodsImage()); ?>" class="goods-thumb">
                                                </a>
                                                <a class="goods-name"><?php echo $this->escapeHtml($this->orderGoodsInfo->getGoodsName()); ?></a>
                                                <span class="goods-amount">x <?php echo $this->orderGoodsInfo->getBuyNum(); ?></span>
                                            </li>
                                        </ul>
                                    </td>
                                    <td class="column-price">
                                        <div class="order-info order-price"><?php echo $this->orderGoodsInfo->getGoodsItem(); ?></div>
                                    </td>
                                    <td class="column-date">
                                        <?php echo $this->escapeHtml($this->orderGoodsInfo->getInSpecGoodsStr()); ?>
                                    </td>
                                    <td class="column-action">
                                        <?php if ($this->orderGoodsInfo->getEvaluationStatus() == 1) echo $this->translate('已评价'); else echo $this->translate('未评价'); ?>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="order-detail-total clearfix">
                                <?php if ($this->orderGoodsInfo->getEvaluationStatus() == 1) { ?>
                                    <P><?php echo $this->translate('评价时间'); ?>：<?php echo date("Y-m-d H:i:s", $this->goodsEvaluation->getEvaluationTime()); ?></P>
                                    <p><?php echo $this->translate('商品评价'); ?>：<?php echo $this->escapeHtml($this->goodsEvaluation->getEvaluationBody()); ?></p>
                                    <p><?php echo $this->translate('商品评分'); ?>：<span class="icon-stat icon-stat-<?php echo $this->goodsEvaluation->getEvaluationStar(); ?> J_mi_goods_starNum" data-class="icon-stat-5"></span></p>
                                <?php } else {
                                    $form = $this->form;
                                    $form->prepare();
                                    $form->setAttributes(['class' => 'form-horizontal']);
                                    $form->get('evaluationBody')->setAttributes(['class' => 'span8']);
                                    ?>
                                    <?php echo $this->form()->openTag($form); ?>
                                        <div class="control-group">
                                            <label class="control-label"><?php echo $this->translate('商品评分'); ?>：</label>
                                            <div class="controls" id="goods_info">
                                                <label class="radio inline"><input type="radio" name="evaluationStar" value="5" checked="checked" />
                                                    <div class="rating"><span class="icon-stat icon-stat-5 J_mi_goods_starNum" data-class="icon-stat-5"></span></div>
                                                </label>
                                                <label class="radio inline"><input type="radio" name="evaluationStar" value="4" />
                                                    <div class="rating"><span class="icon-stat icon-stat-4 J_mi_goods_starNum" data-class="icon-stat-5"></span></div>
                                                </label>
                                                <label class="radio inline"><input type="radio" name="evaluationStar" value="3" />
                                                    <div class="rating"><span class="icon-stat icon-stat-3 J_mi_goods_starNum" data-class="icon-stat-5"></span></div>
                                                </label>
                                                <label class="radio inline"><input type="radio" name="evaluationStar" value="2" />
                                                    <div class="rating"><span class="icon-stat icon-stat-2 J_mi_goods_starNum" data-class="icon-stat-5"></span></div>
                                                </label>
                                                <label class="radio inline"><input type="radio" name="evaluationStar" value="1" />
                                                    <div class="rating"><span class="icon-stat icon-stat-1 J_mi_goods_starNum" data-class="icon-stat-5"></span></div>
                                                </label>
                                                <?php echo $this->formElementErrors($form->get('evaluationStar'), ['class'=>'error-message']); ?>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label class="control-label"><?php echo $this->translate('商品评价'); ?>：</label>
                                            <div class="controls">
                                                <?php echo $this->formElement($form->get('evaluationBody')); ?>
                                                <?php echo $this->formElementErrors($form->get('evaluationBody'), ['class'=>'error-message']); ?>
                                            </div>
                                        </div>
                                        <div class="offset3">
                                            <button class="btn btn-primary" type="submit"><?php echo $this->translate('点击提交'); ?></button>
                                        </div>
                                    <?php echo $this->form()->closeTag(); ?>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php if ($this->orderGoodsInfo->getEvaluationStatus() == 0) { ?>
    <script>
        //商品评价
        $(document).ready(function() {
            $("#<?php echo $form->getName(); ?>").validate({
                rules: {
                    evaluationBody: {
                        required: true,
                        minlength:2,
                        maxlength:600
                    }
                },
                messages: {
                    evaluationBody: {
                        required: "<?php echo $this->translate('请输入评价内容!'); ?>",
                        minlength:"<?php echo $this->translate('评价内容最少两个汉字!'); ?>",
                        maxlength:"<?php echo $this->translate('评价内容最多600个汉字!'); ?>"
                    }
                }
            });
        });
    </script>
<?php } ?>